home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 June
/
PCWorld_2007-06_cd.bin
/
zabezpeceni
/
spyeraser
/
spyeraser.exe
/
{app}
/
SpyEraser.dll
/
2110
/
FLEXCROLL.JS
< prev
next >
Wrap
Text File
|
2007-04-23
|
21KB
|
422 lines
/*
fleXcroll v1.8.5 Public License Version
This license text has to stay intact at all times:
Cross Browser Custom Scroll Bar Script by Hesido.
Public version - Free for non-commercial uses.
This script cannot be used in any commercially built
web sites, or in sites that relates to commercial
activities.
Derivative works are only allowed for personal uses,
and they cannot be redistributed.
For licensing options:
Contact Emrah BASKAYA @ www.hesido.com
FleXcroll Public Key Code: 20050907122003339
MD5 hash for this license: 9ada3be4d7496200ab2665160807745d
End of license text---
*/
function CSBfleXcroll(targetId){
var dC=document,wD=window,nV=navigator;
if(!dC.getElementById||dC.getElementById(targetId)==null||!dC.createElement||(nV.userAgent.indexOf('Safari')!=-1&&!(typeof(HTMLElement)!="undefined"&&HTMLElement.prototype))||nV.vendor=='KDE'||(nV.platform.indexOf('Mac')!=-1&&nV.userAgent.indexOf('MSIE')!=-1))return;
var dDv=dC.getElementById(targetId);
if(dDv.fleXcroll)return;
dDv.fleXdata=new Object();var sC=dDv.fleXdata;
sC.keyAct={_37:['-1s',0],_38:[0,'-1s'],_39:['1s',0],_40:[0,'1s'],_33:[0,'-1p'],_34:[0,'1p'],_36:[0,'-100p'],_35:[0,'+100p']};
sC.wheelAct=["-2s","2s"];
sC.baseAct=["-2s","2s"];
var cDv=createDiv('contentwrapper',true),mDv=createDiv('mcontentwrapper',true),tDv=createDiv('scrollwrapper',true),pDv=createDiv('copyholder',true);
var iDv=createDiv('domfixdiv',true),fDv=createDiv('zoomdetectdiv',true); stdMode=false;
pDv.sY.border='1px solid blue';pDv.fHide();
dDv.style.overflow='hidden';
fDv.sY.fontSize="12px";fDv.sY.height="1em";fDv.sY.width="1em";fDv.sY.position="absolute";fDv.sY.zIndex="-999";fDv.fHide();
var brdHeight=dDv.offsetHeight,brdWidth=dDv.offsetWidth;
copyStyles(dDv,pDv,'0px',['border-left-width','border-right-width','border-top-width','border-bottom-width']);
var intlHeight=dDv.offsetHeight,intlWidth=dDv.offsetWidth,brdWidthLoss=brdWidth-intlWidth,brdHeightLoss=brdHeight-intlHeight;
var oScrollY=(dDv.scrollTop)?dDv.scrollTop:0,oScrollX=(dDv.scrollLeft)?dDv.scrollLeft:0;
var focusProtectList=['textarea','input','select'];
sC.scroller=[];sC.forcedBar=[];sC.containerSize=sC.cntRSize=[];sC.contentSize=sC.cntSize=[];sC.edge=[false,false];
sC.reqS=[];sC.barSpace=[0,0];sC.forcedHide=[];sC.forcedPos=[];sC.paddings=[];
while (dDv.firstChild) {cDv.appendChild(dDv.firstChild)};
cDv.appendChild(iDv);dDv.appendChild(mDv);dDv.appendChild(pDv);
if(getStyle(dDv,'position')!='absolute') dDv.style.position="relative";
mDv.sY.width="100px";mDv.sY.height="100px";mDv.sY.top="0px";mDv.sY.left="0px";
copyStyles(dDv,pDv,"0px",['padding-left','padding-top','padding-right','padding-bottom']);
var postWidth=dDv.offsetWidth,postHeight=dDv.offsetHeight,mHeight;
mHeight=mDv.offsetHeight;mDv.sY.borderBottom="2px solid black";
if(mDv.offsetHeight>mHeight)stdMode=true;mDv.sY.borderBottomWidth="0px";
copyStyles(pDv,dDv,false,['padding-left','padding-top','padding-right','padding-bottom']);
findPos(mDv);findPos(dDv);
sC.paddings[0]=mDv.yPos-dDv.yPos;sC.paddings[2]=mDv.xPos-dDv.xPos;
dDv.style.paddingTop=getStyle(dDv,"padding-bottom");dDv.style.paddingLeft=getStyle(dDv,"padding-right");
findPos(mDv);findPos(dDv);
sC.paddings[1]=mDv.yPos-dDv.yPos;sC.paddings[3]=mDv.xPos-dDv.xPos;
dDv.style.paddingTop=getStyle(pDv,"padding-top");dDv.style.paddingLeft=getStyle(pDv,"padding-left");
var padWidthComp=sC.paddings[2]+sC.paddings[3],padHeightComp=sC.paddings[0]+sC.paddings[1];
copyStyles(dDv,mDv,false,['padding-left','padding-right','padding-top','padding-bottom']);
tDv.sY.width=dDv.offsetWidth+'px';tDv.sY.height=dDv.offsetHeight+'px';
mDv.sY.width=postWidth+'px'; mDv.sY.height=postHeight+'px';
tDv.sY.position='absolute';tDv.sY.top='0px';tDv.sY.left='0px';
tDv.fHide();
mDv.appendChild(cDv);dDv.appendChild(tDv);tDv.appendChild(fDv);
cDv.sY.position='relative';mDv.sY.position='relative';
cDv.sY.top="0";cDv.sY.width="100%";//fix IE7
mDv.sY.overflow='hidden';
mDv.sY.left="-"+sC.paddings[2]+"px";
mDv.sY.top="-"+sC.paddings[0]+"px";
sC.zTHeight=fDv.offsetHeight;
sC.getContentWidth=function(){
var cChilds=cDv.childNodes,maxCWidth=compPad=0;
for(var i=0;i<cChilds.length;i++){if(cChilds[i].offsetWidth){maxCWidth=Math.max(cChilds[i].offsetWidth,maxCWidth)}};
sC.cntRSize[0]=((sC.reqS[1]&&!sC.forcedHide[1])||sC.forcedBar[1])?dDv.offsetWidth-sC.barSpace[0]:dDv.offsetWidth;
sC.cntSize[0]=maxCWidth+padWidthComp;
return sC.cntSize[0];
};
sC.getContentHeight=function(){
sC.cntRSize[1]=((sC.reqS[0]&&!sC.forcedHide[0])||sC.forcedBar[0])?dDv.offsetHeight-sC.barSpace[1]:dDv.offsetHeight;
sC.cntSize[1]=cDv.offsetHeight+padHeightComp-2;
return sC.cntSize[1];
};
sC.fixIEDispBug=function(){cDv.sY.display='none';cDv.sY.display='block';};
sC.setWidth=function(){mDv.sY.width=(stdMode)?(sC.cntRSize[0]-padWidthComp-brdWidthLoss)+'px':sC.cntRSize[0]+'px';};
sC.setHeight=function(){mDv.sY.height=(stdMode)?(sC.cntRSize[1]-padHeightComp-brdHeightLoss)+'px':sC.cntRSize[1]+'px';};
sC.createScrollBars=function(){
sC.getContentWidth();sC.getContentHeight();
//vert
tDv.vrt=new Array();var vrT=tDv.vrt;
createScrollBars(vrT,'vscroller');
vrT.barPadding=[parseInt(getStyle(vrT.sBr,'padding-top')),parseInt(getStyle(vrT.sBr,'padding-bottom'))];
vrT.sBr.sY.padding='0px';vrT.sBr.curPos=0;vrT.sBr.vertical=true;
vrT.sBr.indx=1; cDv.vBar=vrT.sBr;
prepareScroll(vrT,0);sC.barSpace[0]=vrT.sDv.offsetWidth;sC.setWidth();
//horiz
tDv.hrz=new Array();var hrZ=tDv.hrz;
createScrollBars(hrZ,'hscroller');
hrZ.barPadding=[parseInt(getStyle(hrZ.sBr,'padding-left')),parseInt(getStyle(hrZ.sBr,'padding-right'))];
hrZ.sBr.sY.padding='0px';hrZ.sBr.curPos=0;hrZ.sBr.vertical=false;
hrZ.sBr.indx=0; cDv.hBar=hrZ.sBr;
if(wD.opera) hrZ.sBr.sY.position='relative';
prepareScroll(hrZ,0);
sC.barSpace[1]=hrZ.sDv.offsetHeight;sC.setHeight();
tDv.sY.height=dDv.offsetHeight+'px';
// jog
hrZ.jBox=createDiv('scrollerjogbox');
tDv.appendChild(hrZ.jBox);hrZ.jBox.onmousedown=function(){
hrZ.sBr.scrollBoth=true;sC.goScroll=hrZ.sBr;hrZ.sBr.clicked=true;
hrZ.sBr.moved=false;tDv.vrt.sBr.moved=false;
addTrggr(dC,'selectstart',retFalse);addTrggr(dC,'mousemove',mMoveBar);addTrggr(dC,'mouseup',mMouseUp);
return false;
};
};
sC.goScroll=null;
sC.createScrollBars();
cDv.removeChild(iDv);
if(!addChckTrggr(dDv,'mousewheel',mWheelProc)||!addChckTrggr(dDv,'DOMMouseScroll',mWheelProc)){dDv.onmousewheel=mWheelProc;};
dDv.setAttribute('tabIndex','0');
addTrggr(dDv,'keydown',function(e){
if(dDv.focusProtect) return;
if(!e){var e=wD.event;};var pK=e.keyCode; sC.pkeY=pK;
if(sC.keyAct['_'+pK]&&!window.opera){dDv.contentScroll(sC.keyAct['_'+pK][0],sC.keyAct['_'+pK][1],true);if(e.preventDefault) e.preventDefault();return false;};
});
addTrggr(dDv,'keypress',function(e){//make Opera Happy
if(dDv.focusProtect) return;
if(!e){var e=wD.event;};var pK=e.keyCode;
if(sC.keyAct['_'+pK]){dDv.contentScroll(sC.keyAct['_'+pK][0],sC.keyAct['_'+pK][1],true);if(e.preventDefault) e.preventDefault();return false;};
});
addTrggr(dDv,'keyup',function(){sC.pkeY=false});
addTrggr(dC,'mouseup',intClear);
addTrggr(dDv,'mousedown',function(e){
if(!e) e=wD.event;
var cTrgt=(e.target)?e.target:(e.srcElement)?e.srcElement:false;
if(!cTrgt||(cTrgt.className&&cTrgt.className.match(RegExp("\\bscrollgeneric\\b")))) return;
sC.inMposX=e.clientX;sC.inMposY=e.clientY;
pageScrolled();findPos(dDv);intClear();
addTrggr(dC,'mousemove',tSelectMouse);
sC.mTBox=[dDv.xPos+10,dDv.xPos+sC.cntRSize[0]-10,dDv.yPos+10,dDv.yPos+sC.cntRSize[1]-10];
});
function tSelectMouse(e){if(!e) e=wD.event;
var mX=e.clientX,mY=e.clientY,mdX=mX+sC.xScrld,mdY=mY+sC.yScrld;
sC.mOnXEdge=(mdX<sC.mTBox[0]||mdX>sC.mTBox[1])?1:0;
sC.mOnYEdge=(mdY<sC.mTBox[2]||mdY>sC.mTBox[3])?1:0;
sC.xAw=mX-sC.inMposX;sC.yAw=mY-sC.inMposY;
sC.sXdir=(sC.xAw>40)?1:(sC.xAw<-40)?-1:0;sC.sYdir=(sC.yAw>40)?1:(sC.yAw<-40)?-1:0;
if((sC.sXdir!=0||sC.sYdir!=0)&&!sC.tSelectFunc) sC.tSelectFunc=wD.setInterval(function(){
if(sC.sXdir==0&&sC.sYdir==0){wD.clearInterval(sC.tSelectFunc);sC.tSelectFunc=false;return;};pageScrolled();
if(sC.mOnXEdge==1||sC.mOnYEdge==1) dDv.contentScroll((sC.sXdir*sC.mOnXEdge)+"s",(sC.sYdir*sC.mOnYEdge)+"s",true);
},45)
}
function intClear(){
remTrggr(dC,'mousemove',tSelectMouse);if(sC.tSelectFunc) wD.clearInterval(sC.tSelectFunc);sC.tSelectFunc=false;
if(sC.barClickRetard) wD.clearTimeout(sC.barClickRetard); if(sC.barClickScroll) wD.clearInterval(sC.barClickScroll);
}
function pageScrolled(){
sC.xScrld=(wD.pageXOffset)?wD.pageXOffset:(dC.documentElement&&dC.documentElement.scrollLeft)?dC.documentElement.scrollLeft:0;
sC.yScrld=(wD.pageYOffset)?wD.pageYOffset:(dC.documentElement&&dC.documentElement.scrollTop)?dC.documentElement.scrollTop:0;
}
dDv.scrollUpdate=function(recurse){
if(tDv.getSize[1]()===0||tDv.getSize[0]()===0) return;
cDv.sY.padding='1px';var reqH=sC.reqS[0],reqV=sC.reqS[1],vBr=tDv.vrt,hBr=tDv.hrz,vUpReq,hUpReq,cPSize=[];
tDv.sY.width=dDv.offsetWidth-brdWidthLoss+'px';tDv.sY.height=dDv.offsetHeight-brdHeightLoss+'px';
cPSize[0]=sC.cntRSize[0];cPSize[1]=sC.cntRSize[1];
sC.reqS[0]=sC.getContentWidth()>sC.cntRSize[0];
sC.reqS[1]=sC.getContentHeight()>sC.cntRSize[1];
var stateChange=(reqH!=sC.reqS[0]||reqV!=sC.reqS[1]||cPSize[0]!=sC.cntRSize[0]||cPSize[1]!=sC.cntRSize[1])?true:false;
vBr.sDv.setVisibility(sC.reqS[1]);hBr.sDv.setVisibility(sC.reqS[0]);
vUpReq=(sC.reqS[1]||sC.forcedBar[1]);hUpReq=(sC.reqS[0]||sC.forcedBar[0]);
sC.getContentWidth();sC.getContentHeight();sC.setHeight();sC.setWidth();
if(!sC.reqS[0]||!sC.reqS[1]||sC.forcedHide[0]||sC.forcedHide[1]) hBr.jBox.fHide();
else hBr.jBox.fShow();
if(vUpReq) updateScroll(vBr,(hUpReq&&!sC.forcedHide[0])?sC.barSpace[1]:0);else cDv.sY.top="0";
if(hUpReq) updateScroll(hBr,(vUpReq&&!sC.forcedHide[1])?sC.barSpace[0]:0);else cDv.sY.left="0";
if(stateChange&&!recurse) dDv.scrollUpdate(true);
cDv.sY.padding='0px';
};
dDv.commitScroll=dDv.contentScroll=function(xPos,yPos,relative){
var reT=[[false,false],[false,false]],Bar;
if((xPos||xPos===0)&&sC.scroller[0]){xPos=calcCScrollVal(xPos,0);Bar=tDv.hrz.sBr;Bar.trgtScrll=(relative)?Math.min(Math.max(Bar.mxScroll,Bar.trgtScrll-xPos),0):-xPos;Bar.contentScrollPos();reT[0]=[-Bar.trgtScrll,-Bar.mxScroll]}
if((yPos||yPos===0)&&sC.scroller[1]){yPos=calcCScrollVal(yPos,1);Bar=tDv.vrt.sBr;Bar.trgtScrll=(relative)?Math.min(Math.max(Bar.mxScroll,Bar.trgtScrll-yPos),0):-yPos;Bar.contentScrollPos();reT[1]=[-Bar.trgtScrll,-Bar.mxScroll]}
return reT;
};
copyStyles(pDv,dDv,'0px',['border-left-width','border-right-width','border-top-width','border-bottom-width']);
dDv.removeChild(pDv);
dDv.fleXcroll=true;
dDv.scrollUpdate();
dDv.contentScroll(oScrollX,oScrollY,true);
tDv.fShow();
sC.sizeChangeDetect=wD.setInterval(function(){
var n=fDv.offsetHeight;if(n!=sC.zTHeight){dDv.scrollUpdate();sC.zTHeight=n};
},2500);
function calcCScrollVal(v,i){
var stR=v.toString();v=parseFloat(stR);
return parseInt((stR.match(/p$/))?v*sC.cntRSize[i]*0.9:(stR.match(/s$/))?v*sC.cntRSize[i]*0.1:v);
}
function camelConv(spL){
var spL=spL.split('-'),reT=spL[0],i;
for(i=1;parT=spL[i];i++) {reT +=parT.charAt(0).toUpperCase()+parT.substr(1);}
return reT;
}
function getStyle(elem,style){
if(wD.getComputedStyle) return wD.getComputedStyle(elem,null).getPropertyValue(style);
if(elem.currentStyle) return elem.currentStyle[camelConv(style)];
return false;
};
function copyStyles(src,dest,replaceStr,sList){
var camelList = new Array();
for (var i=0;i<sList.length;i++){
camelList[i]=camelConv(sList[i]);
dest.style[camelList[i]] = getStyle(src,sList[i],camelList[i]);
if(replaceStr) src.style[camelList[i]] = replaceStr;
}
};
function createDiv(typeName,noGenericClass){
var nDiv=dC.createElement('div');
nDiv.id=targetId+'_'+typeName;
nDiv.className=(noGenericClass)?typeName:typeName+' scrollgeneric';
nDiv.getSize=[function(){return nDiv.offsetWidth;},function(){return nDiv.offsetHeight;}];
nDiv.setSize=[function(sVal){nDiv.sY.width=sVal;},function(sVal){nDiv.sY.height=sVal;}];
nDiv.getPos=[function(){return getStyle(nDiv,"left");},function(){return getStyle(nDiv,"top");}];
nDiv.setPos=[function(sVal){nDiv.sY.left=sVal;},function(sVal){nDiv.sY.top=sVal;}];
nDiv.fHide=function(){nDiv.sY.visibility="hidden"};
nDiv.fShow=function(){nDiv.sY.visibility="visible"};
nDiv.sY=nDiv.style;
return nDiv;
};
function createScrollBars(ary,bse){
ary.sDv=createDiv(bse+'base');ary.sFDv=createDiv(bse+'basebeg');
ary.sSDv=createDiv(bse+'baseend');ary.sBr=createDiv(bse+'bar');
ary.sFBr=createDiv(bse+'barbeg');ary.sSBr=createDiv(bse+'barend');
tDv.appendChild(ary.sDv);ary.sDv.appendChild(ary.sBr);
ary.sDv.appendChild(ary.sFDv);ary.sDv.appendChild(ary.sSDv);
ary.sBr.appendChild(ary.sFBr);ary.sBr.appendChild(ary.sSBr);
};
function prepareScroll(bAr,reqSpace){
var sDv=bAr.sDv,sBr=bAr.sBr,i=sBr.indx;
sBr.minPos=bAr.barPadding[0];
sBr.ofstParent=sDv;
sBr.mDv=mDv;
sBr.scrlTrgt=cDv;
sBr.targetSkew=0;
updateScroll(bAr,reqSpace,true);
sBr.doScrollPos=function(){
sBr.curPos=(Math.min(Math.max(sBr.curPos,0),sBr.maxPos));
sBr.trgtScrll=parseInt((sBr.curPos/sBr.sRange)*sBr.mxScroll);
sBr.targetSkew=(sBr.curPos==0)?0:(sBr.curPos==sBr.maxPos)?0:sBr.targetSkew;
sBr.setPos[i](sBr.curPos+sBr.minPos+"px");
cDv.setPos[i](sBr.trgtScrll+sBr.targetSkew+"px");
};
sBr.contentScrollPos=function(){
sBr.curPos=parseInt((sBr.trgtScrll*sBr.sRange)/sBr.mxScroll);
sBr.targetSkew=sBr.trgtScrll-parseInt((sBr.curPos/sBr.sRange)*sBr.mxScroll);
sBr.curPos=(Math.min(Math.max(sBr.curPos,0),sBr.maxPos));
sBr.setPos[i](sBr.curPos+sBr.minPos+"px");
sBr.setPos[i](sBr.curPos+sBr.minPos+"px");
cDv.setPos[i](sBr.trgtScrll+"px");
};
sC.barZ=getStyle(sBr,'z-index');
sBr.sY.zIndex=(sC.barZ=="auto"||sC.barZ=="0")?2:sC.barZ;
mDv.sY.zIndex=getStyle(sBr,'z-index');
sBr.onmousedown=function(){
sBr.clicked=true;sC.goScroll=sBr;sBr.scrollBoth=false;sBr.moved=false;
addTrggr(dC,'selectstart',retFalse);
addTrggr(dC,'mousemove',mMoveBar);
addTrggr(dC,'mouseup',mMouseUp);
return false;
};
sBr.onmouseover=intClear;
sDv.onmousedown=sDv.ondblclick=function(e){
if(!e){var e=wD.event;}
if(e.target&&(e.target==bAr.sFBr||e.target==bAr.sSBr||e.target==bAr.sBr)) return;
if(e.srcElement&&(e.srcElement==bAr.sFBr||e.srcElement==bAr.sSBr||e.srcElement==bAr.sBr)) return;
var relPos,mV=[];pageScrolled();sBr.mDv.scrollTop=0;sBr.mDv.scrollLeft=0;findPos(sBr);
relPos=(sBr.vertical)?e.clientY+sC.yScrld-sBr.yPos:e.clientX+sC.xScrld-sBr.xPos;
mV[sBr.indx]=(relPos<0)?sC.baseAct[0]:sC.baseAct[1];mV[1-sBr.indx]=0;
dDv.contentScroll(mV[0],mV[1],true);
intClear();
sC.barClickRetard=wD.setTimeout(function(){
sC.barClickScroll=wD.setInterval(function(){
dDv.contentScroll(mV[0],mV[1],true);},80)},425);
return false;
};
sDv.setVisibility=function(r){
if(r){sDv.fShow();
sC.forcedHide[i]=(getStyle(sDv,"visibility")=="hidden")?true:false;
if(!sC.forcedHide[i]) sBr.fShow(); else sBr.fHide();
sC.scroller[i]=true;classChange(sDv,"","flexinactive");}
else{sDv.fHide();sBr.fHide();
sC.forcedBar[i]=(getStyle(sDv,"visibility")!="hidden")?true:false;
sC.scroller[i]=false;sBr.curPos=0;cDv.setPos[i]('0px');
classChange(sDv,"flexinactive","");}
mDv.setPos[1-i]((sC.forcedPos[i]&&(r||sC.forcedBar[i])&&!sC.forcedHide[i])?sC.barSpace[1-i]-sC.paddings[i*2]+"px":"-"+sC.paddings[i*2]+"px");
};
sDv.onmouseclick = retFalse;
};
function updateScroll(bAr,reqSpace,firstRun){
var sDv=bAr.sDv,sBr=bAr.sBr,sFDv=bAr.sFDv,sFBr=bAr.sFBr,sSDv=bAr.sSDv,sSBr=bAr.sSBr,i=sBr.indx;
sDv.setSize[i](tDv.getSize[i]()-reqSpace+'px');sDv.setPos[1-i](tDv.getSize[1-i]()-sDv.getSize[1-i]()+'px');
sC.forcedPos[i]=(parseInt(sDv.getPos[1-i]())===0)?true:false;
bAr.padLoss=bAr.barPadding[0]+bAr.barPadding[1];bAr.baseProp=parseInt((sDv.getSize[i]()-bAr.padLoss)*0.75);
sBr.aSize=Math.min(Math.max(Math.min(parseInt(sC.cntRSize[i]/sC.cntSize[i]*sDv.getSize[i]()),bAr.baseProp),45),bAr.baseProp);
sBr.setSize[i](sBr.aSize+'px');sBr.maxPos=sDv.getSize[i]()-sBr.getSize[i]()-bAr.padLoss;
sBr.curPos=Math.min(Math.max(0,sBr.curPos),sBr.maxPos);
sBr.setPos[i](sBr.curPos+sBr.minPos+'px');sBr.mxScroll=mDv.getSize[i]()-sC.cntSize[i];
sBr.sRange=sBr.maxPos;
sFDv.setSize[i](sDv.getSize[i]()-sSDv.getSize[i]()+'px');
sFBr.setSize[i](sBr.getSize[i]()-sSBr.getSize[i]()+'px');
sSBr.setPos[i](sBr.getSize[i]()-sSBr.getSize[i]()+'px');
sSDv.setPos[i](sDv.getSize[i]()-sSDv.getSize[i]()+'px');
if(!firstRun) sBr.doScrollPos();
sC.fixIEDispBug();
};
addTrggr(wD,'load',function(){if(dDv.fleXcroll) dDv.scrollUpdate();});
addTrggr(wD,'resize',function(){
if(dDv.refreshTimeout) wD.clearTimeout(dDv.refreshTimeout);
dDv.refreshTimeout=wD.setTimeout(function(){if(dDv.fleXcroll) dDv.scrollUpdate();},80);
});
for(var j=0,inputName;inputName=focusProtectList[j];j++){
var inputList=dDv.getElementsByTagName(inputName);
for(var i=0,formItem;formItem=inputList[i];i++){
addTrggr(formItem,'focus',function(){dDv.focusProtect=true;});
addTrggr(formItem,'blur',onblur=function(){dDv.focusProtect=false;});
}};
function retFalse(){return false;};
function mMoveBar(e){
if(!e){var e=wD.event;};
var FCBar=sC.goScroll,movBr,maxx,xScroll,yScroll;
if(FCBar==null) return;
maxx=(FCBar.scrollBoth)?2:1;
for (var i=0;i<maxx;i++){
movBr=(i==1)?FCBar.scrlTrgt.vBar:FCBar;
if(FCBar.clicked){
if(!movBr.moved){
movBr.mDv.scrollTop=0;movBr.mDv.scrollLeft=0;
findPos(movBr);findPos(movBr.ofstParent);movBr.pointerOffsetY=e.clientY-movBr.yPos;
movBr.pointerOffsetX=e.clientX-movBr.xPos;movBr.inCurPos=movBr.curPos;movBr.moved=true;
};
movBr.curPos=(movBr.vertical)?e.clientY-movBr.pointerOffsetY-movBr.ofstParent.yPos-movBr.minPos:e.clientX-movBr.pointerOffsetX-movBr.ofstParent.xPos-movBr.minPos;
if(FCBar.scrollBoth) movBr.curPos=movBr.curPos+(movBr.curPos-movBr.inCurPos);
movBr.doScrollPos();
} else movBr.moved=false;
};
};
function mMouseUp(){
if(sC.goScroll!=null){sC.goScroll.clicked=false;}
sC.goScroll=null;
remTrggr(dC,'selectstart',retFalse);
remTrggr(dC,'mousemove',mMoveBar);
remTrggr(dC,'mouseup',mMouseUp);
};
function mWheelProc(e){
if(!e) e=wD.event;
if(!this.fleXcroll) return;
var scrDv=this,vEdge,hEdge,hoverH=false,delta=0,iNDx;
hElem=(e.target)?e.target:(e.srcElement)?e.srcElement:this;
if(hElem.id&&hElem.id.match(/_hscroller/)) hoverH=true;
if(e.wheelDelta) delta=-e.wheelDelta;if(e.detail) delta=e.detail;
delta=(delta<0)?-1:+1;iNDx=(delta<0)?0:1;sC.edge[1-iNDx]=false;
if((sC.edge[iNDx]&&!hoverH)||(!sC.scroller[0]&&!sC.scroller[1])) return;
if(sC.scroller[1]&&!hoverH) scrollState=dDv.contentScroll(false,sC.wheelAct[iNDx],true);
vEdge=!sC.scroller[1]||hoverH||(sC.scroller[1]&&((scrollState[1][0]==scrollState[1][1]&&delta>0)||(scrollState[1][0]==0&&delta<0)));
if(sC.scroller[0]&&(!sC.scroller[1]||hoverH)) scrollState=dDv.contentScroll(sC.wheelAct[iNDx],false,true);
hEdge=!sC.scroller[0]||(sC.scroller[0]&&sC.scroller[1]&&vEdge&&!hoverH)||(sC.scroller[0]&&((scrollState[0][0]==scrollState[0][1]&&delta>0)||(scrollState[0][0]==0&&delta<0)));
if(vEdge&&hEdge&&!hoverH) sC.edge[iNDx]=true; else sC.edge[iNDx]=false;
if(e.preventDefault) e.preventDefault();
return false;
};
function addTrggr(elm,eventname,func){if(!addChckTrggr(elm,eventname,func)&&elm.attachEvent) {elm.attachEvent('on'+eventname,func);}};
function addChckTrggr(elm,eventname,func){if(elm.addEventListener){elm.addEventListener(eventname,func,false);wD.addEventListener("unload",function(){remTrggr(elm,eventname,func)},false);return true;} else return false;};
function remTrggr(elm,eventname,func){if(!remChckTrggr(elm,eventname,func)&&elm.detachEvent) elm.detachEvent('on'+eventname,func);};
function remChckTrggr(elm,eventname,func){if(elm.removeEventListener){elm.removeEventListener(eventname,func,false);return true;} else return false;};
function findPos(elem){
//modified from firetree.net
var obj=elem,curleft=curtop=0;
if(obj.offsetParent){while(obj){curleft+=obj.offsetLeft;curtop+=obj.offsetTop;obj=obj.offsetParent;}}
else if(obj.x){curleft+=obj.x;curtop+=obj.y;}
elem.xPos=curleft;elem.yPos=curtop;
};
function classChange(elem,addClass,remClass) {
if(!elem.className) elem.className = '';var clsnm=elem.className;
if(addClass&&!clsnm.match(RegExp("\\b"+addClass+"\\b"))) clsnm=clsnm.replace(/(\S$)/,'$1 ')+addClass;
if(remClass) clsnm=clsnm.replace(RegExp("(\\s*\\b"+remClass+"\\b(\\s*))*","g"),'$2');
elem.className=clsnm;
};
};